package com.baseframe.system.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baseframe.system.entity.vo.BaseMenuVO;
import com.baseframe.system.service.BaseMenuService;
import com.baseframe.tool.result.R;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/back/menu")
@AllArgsConstructor
public class BackBaseMenuController {

    private BaseMenuService baseMenuService;


    /**
     * 通过角色编号获取被角色控制的菜单
     * @return 菜单集合
     */
    @GetMapping("/get/list")
    public R<List<BaseMenuVO>> loadingMenu(){


        List<BaseMenuVO> menuList = baseMenuService.loadingMenu();

        return R.data(menuList);
    }


    /**
     * 菜单分页管理
     * @param page
     * @param menuName
     * @return
     */
    @GetMapping("/page/list")
    public R<Page<BaseMenuVO>> menuPageList(Page<BaseMenuVO> page, String menuName){

        Page<BaseMenuVO> menuPage = baseMenuService.menuPageList(page,menuName);

        return R.data(menuPage);

    }







}
